package com.simpleframe.views.chart.attribution;

/**
 * 数据点的样式
 * 
 * @author Administrator
 * 
 */
public class ChartElementsDotStyle {
	
	/**
	 * 箭状
	 */
	public static final String TYPE_BOW = "bow";
	/**
	 * 多边形
	 */
	public static final String TYPE_ANCHOR = "anchor";
	/**
	 * 星形点
	 */
	public static final String TYPE_STAR = "star";
	/**
	 * 圆点
	 */
	public static final String TYPE_DOT = "dot";
	/**
	 * 实心点
	 */
	public static final String TYPE_SOLID_DOT = "solid-dot";
	/**
	 * 空心点
	 */
	public static final String TYPE_HOLLOW_DOT = "hollow-dot";

	/**
	 * 点的类型
	 */
	private String type;

	/**
	 * 点的颜色
	 */
	private String colour;

	/**
	 * 点的大小
	 */
	private int dotSize;

	/**
	 * 多边形的边数（仅点类型为anchor才有效）
	 */
	private int sizes;

	/**
	 * 点是否中空，true为中空，false为实心
	 */
	private boolean hollow;
	
	/**
	 * 点提示
	 */
	private String tip;

	public ChartElementsDotStyle(String type, String colour, int dotSize,
			int sizes, boolean hollow, String tip) {
		this.type = type;
		this.colour = colour;
		this.dotSize = dotSize;
		this.sizes = sizes;
		this.hollow = hollow;
		this.tip = tip;
	}

	public ChartElementsDotStyle() {

	}

	/**
	 * 默认设置
	 */
	public void DefaultSetting() {
		type = new String(TYPE_SOLID_DOT);
		colour = new String();
		dotSize = 2;
		sizes = 3;
		hollow = true;
		tip ="#x_label#<br>#y#";
	}

	/**
	 * 将点的样式的所有属性以字符串的形式返回
	 * 
	 * @return
	 */
	public String getDotStyleString() {
		StringBuffer sb = new StringBuffer();
		sb.append("\t");
		sb.append(ChartTool.addQuotes("dot-style") + ":");
		sb.append("{");

		sb.append(ChartTool.addQuotes("type") + ":");
		sb.append(ChartTool.addQuotes(type) + ",");

		sb.append(ChartTool.addQuotes("colour") + ":");
		sb.append(ChartTool.addQuotes(colour) + ",");

		sb.append(ChartTool.addQuotes("sizes") + ":");
		sb.append(ChartTool.checkField("" + sizes) + ",");

		sb.append(ChartTool.addQuotes("dot-size") + ":");
		sb.append(ChartTool.checkField("" + dotSize) + ",");

		sb.append(ChartTool.addQuotes("hollow") + ":");
		sb.append(ChartTool.checkField("" + hollow)+ ",");
		
		sb.append(ChartTool.addQuotes("tip") + ":");
		sb.append(ChartTool.addQuotes(tip));

		sb.append("},\n");
		return sb.toString();
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getColour() {
		return colour;
	}

	public void setColour(String colour) {
		this.colour = colour;
	}

	public int getDotSize() {
		return dotSize;
	}

	public void setDotSize(int dotSize) {
		this.dotSize = dotSize;
	}

	public boolean isHollow() {
		return hollow;
	}

	public void setHollow(boolean hollow) {
		this.hollow = hollow;
	}

	public int getSizes() {
		return sizes;
	}

	public void setSizes(int sizes) {
		this.sizes = sizes;
	}

	public String getTip() {
		return tip;
	}

	public void setTip(String tip) {
		this.tip = tip;
	}
}
